﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace YouWei.Winform.Common
{
    /// <summary>
    /// 
    /// </summary>
    public class ApiResult
    {
        /// <summary>
        /// 状态码，参考接口文档
        /// 1:成功  否则失败
        /// </summary>
        public int status { get; set; }

        /// <summary>
        /// 消息
        /// </summary>
        public string message { get; set; }


        /// <summary>
        /// 成功方法
        /// </summary>
        /// <param name="_data">返回数据</param>
        /// <param name="msg">返回成功文本</param>
        /// <returns></returns>
        public static ApiResult Success(string msg)
        {
            ApiResult result = new ApiResult
            {
                status = 0,
                message = msg
            };
            return result;
        }

        /// <summary>
        /// 失败方法
        /// </summary>
        /// <param name="errMsg">错误信息</param>
        /// <returns></returns>
        public static ApiResult Error(string errMsg)
        {
            ApiResult result = new ApiResult
            {
                status = -1,
                message = errMsg
            };
            return result;
        }
    }

    public class ApiFileResult
    {

        /// <summary>
        /// 状态码，参考接口文档
        /// 1:成功  否则失败
        /// </summary>
        public int status { get; set; }

        /// <summary>
        /// 消息
        /// </summary>
        public string message { get; set; }

        public byte[] bytes { set; get; }
    }

}